-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom metrics endpoint #1037
Conversation
🦋 Changeset detectedLatest commit: 9baea6d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Stats.initRemoteMetrics( | ||
legacySettings.metrics ?? { host: options.metricsEndpoint } | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if Stats.initRemoteMetrics
receives { host: undefined }
? Given that we were always sending the legacySettings.metrics
object which looks like could be either full or undefined.
I'm also curious if we need this coalescing here as just above we're already overriding it.
/** | ||
* Allows you to change the metrics endpoint used | ||
*/ | ||
metricsEndpoint?: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide some background about the impetus / use case for a new setting (maybe link to the issue / description is OK)? (I saw an issue around this, but I figured we would just default to the overridden apiHost / protocol.)
i.e.
integrations: {
'Segment.io': {
// assume https://MY-CUSTOM-API-PROXY.com/v1/m proxies to
// https://api.segment.io/v1/m
apiHost: 'MY-CUSTOM-API-PROXY.com/v1',
protocol: 'https' // optional
}
(forgive me if I am missing something silly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that makes sense! Updated to default to that value and to respect protocol if set
Allows users to set a custom metrics endpoint when loading Analytics. Tested locally by setting a custom endpoint and confirming it was used.
yarn changeset
. Read about changesets here).